package com.data.modules.online.cgform.converter;

import java.util.Map;
import org.springframework.stereotype.Component;

@Component("customDemoConverter")
public class CustomDemoConverter implements FieldCommentConverter {
    @Override
    public String converterToVal(String txt) {
        if (txt == null || !txt.equals("管理员1")) {
            return txt;
        }
        return "admin";
    }

    @Override
    public String converterToTxt(String val) {
        if (val == null) {
            return val;
        }
        if (val.equals("admin")) {
            return "管理员1";
        }
        if (val.equals("scott")) {
            return "管理员2";
        }
        return val;
    }

    @Override
    public Map<String, String> getConfig() {
        return null;
    }
}
